Buffer
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
Buffer is an API that provides file-like read/write operations over a channel, enabling stream-like bidirectional transfer of binary data with automatic BZ2 compression.
Usage
With RNS:
# Create a buffer over a link's channel
channel = link.get_channel()
buffer = RNS.Buffer.create_bidirectional_buffer(0, 0, channel, ready_callback)
# Write data
buffer.write("hello, world".encode("utf-8"))
buffer.flush()
# Read data in callback
def ready_callback(ready_bytes: int):
data = buffer.read(ready_bytes)
For a more comprehensive use case, see the Buffer example in the manual.
Reticulum concepts
Announce • Blackhole • Buffer • Channel • Destination • Discovery • Identity • Instance • Interface • Interface Access Code (IFAC) • Link • Network identity • Node • Packet • Path • Propagation node • Resource • Stamp • Transport node
Buffer